package com.junjie.checkin.entity.Enum;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;

/**
 * @author 洪浚杰
 * @description
 * @date 2025/6/19 11:13
 */
@Getter
public enum GIftStatusEnum implements StringValuedEnum{
    PUT_ON("putOn", 0),
    SELL_OUT("sellOut", 1),
    REMOVE("remove", 2);
    private final String value;
    private final Integer index;

    @JsonCreator
    public static GIftStatusEnum fromValue(String value) {
        return Arrays.stream(values())
                .filter(e -> e.getValue().equalsIgnoreCase(value))
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("Invalid value: " + value));
    }
    private GIftStatusEnum(String value,Integer index){
        this.value = value;
        this.index = index;
    }
}
